import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_study/utils/Utils.dart';

class FlexStudyPage extends StatelessWidget {
  const FlexStudyPage({Key? key}) : super(key: key);

  Future getString() {
    return Future.delayed(Duration(seconds: 3), () {
      return "3-->data";
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Flex"),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      floatingActionButton: FloatingActionButton(
        child: Text("+"),
        onPressed: (){

        },
      ),
      bottomNavigationBar: BottomAppBar(
        color: Colors.yellow,
        child: Container(height: 50,),
      ),
      body: Container(
        color: Colors.blue,
        child: Column(
          children: [
            Wrap(
              alignment: WrapAlignment.end,
              spacing: 10,
              runSpacing: 20,
              children: [
                Text("1=============1"),
                Text("2=============2"),
                Text("3=============3"),
                Text("4=============4"),
                Text("5=============5"),
              ],
            ),
            Row(
              children: [
                Expanded(
                  child: Container(
                    alignment: Alignment.centerRight,
                    child: Text("==="),
                    color: Colors.red,
                  ),
                  flex: 2,
                ),
                Expanded(child: Text("===")),
                Expanded(child: Text("===")),
              ],
            ),
            FutureBuilder(
              future: getString(),
              builder: (context,snapshot){
                if(snapshot.connectionState==ConnectionState.none){
                  return Text("暂无数据");
                }
                if(snapshot.connectionState==ConnectionState.waiting){
                  return Text("等待....");
                }
                return Text("已完成${snapshot.data}");
              },
            ),
            Container(
              height: 100,
              color: Colors.red,
              child: PageView(
                children: [
                  Text("page1========="),
                  Text("page2========="),
                  Text("page3========="),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
